package com.church.action;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.church.db.Group;
import com.church.db.User;
import com.church.services.GroupServices;
import com.church.services.UserServices;
import com.opensymphony.xwork2.ActionSupport;

public class EditUser extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private UserServices userServices;
	private GroupServices groupServices;
	private User user;
	private long userid;
 
	private Map<Integer,String> groupMap;
	public UserServices getUserServices() {
		return userServices;
	}

	public void setUserServices(UserServices userServices) {
		this.userServices = userServices;
	}

	public GroupServices getGroupServices() {
		return groupServices;
	}

	public void setGroupServices(GroupServices groupServices) {
		this.groupServices = groupServices;
	}

 
	public Map<Integer, String> getGroupMap() {
		return groupMap;
	}

	public void setGroupMap(Map<Integer, String> groupMap) {
		this.groupMap = groupMap;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public long getUserid() {
		return userid;
	}

	public void setUserid(long userid) {
		this.userid = userid;
	}

	public String execute() {
		groupMap = new HashMap<Integer,String>();
		
		for(Group gp:groupServices.getGroup())
		{
			groupMap.put(gp.getId(), gp.getCnName());
		}
		user = userServices.findUserById(userid);
		return "success";
	}

}
